<?php
App::uses ( 'AppController', 'Controller' );
class ContentsController extends AppController {
	public $name = 'Contents';
	
	public function manage($page_name=null){
		if($this->request->data){
			$this->Content->create();
			$this->Content->save($this->request->data);
		}
		$all_pages = $this->Content->find('list',array(
			'fields'=>array('Content.id','Content.display_name'),
			'order' => array('Content.display_name')
			));
		$this->set("pages",$all_pages);
	}
	
	
	public function getContent($page_id){
		$this->autoRender=false;
		$data = $this->Content->find('all',array(
			'conditions'=>array('Content.id'=>$page_id),
			'fields'=>array('Content.content')
			));
		echo $data[0]['Content']['content'];
	}
}